<?php
/**
 * CountPage
 * Version 1.0
 * 
 * Example to use:
 * $countpage = CountPage::get();
 * $countpage = CountPage::get(10,50);
 *
 */

final class CountPage {
	static function get($min=10,$max=40) {
		global $options;
		if (isset($_COOKIE['ipp']) && ($_COOKIE['ipp']*1>=$min)){
			$countpage=$_COOKIE['ipp'];
		} else {
			$countpage=$options['search']['limit_to_page'];
		}
		if ($countpage <$min or $countpage> $max) {
			$countpage = $min;
		}
		$options['search']['limit_to_page'] = $countpage;
		return $countpage;
	}
}

?>
